/*
 * @Author: 东东
 * @Date: 2023-01-05 17:09:12
 * @LastEditors: your Name
 * @LastEditTime: 2023-03-09 17:52:36
 * @Description: 
 */
// 全局树形结构递归处理  按需配置项 可修改

 export const onTreeKey = (target: any[], init = []) => {
  target.forEach(item => {
      // 节点值提换
      // i.key = i.id;
      // i.title = i.name;
      // i.value = i.name;

      // 按需取出所有type = "operation"的name
      item.type === 'operation' && init.push(item.name);
      item.children && onTreeKey(item.children, init);
  });
  return init	;
};

// 拍平
// var a = [
// 	   { fcode:111,
// 	     selected: false},
// 			 { fcode:222,
// 				selected: false},
// 				{ fcode:333,
// 					children:[{fcode:666,
// 						selected: true}],
// 					selected: false},
// 					{ fcode:444,
// 						selected: true}
// ]

// const onTreeKey = (target, init = []) => {
//   target.forEach(item => {
//       item.selected  && init.push(item);
//       item.children && onTreeKey(item.children, init);
//   });
//   return init;
// };
// var c = onTreeKey(a)
// console.log(c)
// 0 {fcode: 666, selected: true}
// 1 {fcode: 444, selected: true}

// 判断一个对象中是否有属性为空？
	// let person = {
	// 	name: "章三",
	// 	age: 25,
	// 	address: "",
	// };
	// console.log(Object.values(person).includes(''))
	//true


// 剔除指定的列
// function deleteArrayWithIndex (arr, index) {
// 	const newArr = [...arr]
// 	newArr.forEach(item => item.splice(index, 1))
// 	return newArr
// }
// a = [
// ['排序', '数量', '价值', '操作人', '时间','名称'],
// ['1', '22', '5.5', '小米', '2022-03','苹果'],
// ['2', '550', '3.5', '小王', '2022-03','香蕉'],
// ['3', '150', '13.5', '小李', '2022-03','西瓜']
// ]
// deleteArrayWithIndex(deleteArrayWithIndex(a, 3), 4)

